package com.wish.contract.enums;

/**
 * @Author: 崔学磊
 * @Date: 2022/3/30 09:43
 * @Description:    收出房枚举
 */
public enum ContractTypeEnum {


    SF("收房", 1),
    CF("出房", 2);

    private String name;
    private int index;

    private ContractTypeEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    // 普通方法
    public static String getName(int index) {
        for (ContractTypeEnum c : ContractTypeEnum.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public static Integer getIndex(String name) {
        for (ContractTypeEnum c : ContractTypeEnum.values()) {
            if (c.getName().equals(name)) {
                return c.getIndex();
            }
        }
        return null;
    }



    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
